<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>

<body>
    <div id="app">
        <h2>大写</h2>
        <p v-case.uppercase="msg1"></p>
        <h2>小写</h2>
        <p v-case.lowercase="msg2"></p>
    </div>
</body>
<script>
    Vue.directive('case', {
        inserted: function (el, binding) {
            let content = binding.value
            let modifiters = binding.modifiters
            if (modifiters.uppercase) {
                el.innerHTML = String(content).toUpperCase()
            } else if (modifiters.lowercase) {
                el.innerHTML = String(content).toLowerCase()
            }
        }
    })
    const vm = new Vue({
        el: '#app',
        data: {
            msg1:'hello',
            msg2:'VUE.JS'
        }
    })
</script>

</html>